#ifndef __GE_NODE_H__
#define __GE_NODE_H__

#include "GE_Base.h"
namespace Syp
{
///Node class which represents all scene data(MeshInstances, Lights, Audio Sources, etc..).
class SYPAPI Node
{
public:	
	Node();
	~Node();
	///Copy constructor
	Node(const Node& node);
	Node& operator=(const Node& node);

	void setPosition(float x, float y, float z,float w = 1.0f);
	void offsetPosition(float x, float y, float z);
	void setOrientation(Quat& q);
	void setOrientation(float x, float y, float z,float w);
	///Sets the current transformation of the node
	void setMatrix(float* matrix);
	///Returns the transformation matrix of this node
	float* getMatrix();
	const Point4 getPosition();
	const Quat getOrientation();
	///Rotates the Node by the quaternion q
	void rotateBy(Quat& q);
	///Rotates Node around current local axis, angle is is degrees
	void rotateAroundLocalAxis(AngleAxis a);
	///Rotates node around axis at origin
	//void rotateAroundOrigin(AngleAxis a);
	///Rotates Node around current world axis, angle is is degrees
	void rotateAroundWorldAxis(AngleAxis a);
	///binds Node to n. 
	void bindToNode(Node* n);
	void unBindFromParent();
	///Returns a pointer to the parent Node.
	Node* getParentPtr();
private:
	///A Node can have multiple children, but only 1 parent
	std::vector<Node*> children;
	Node* parent;

	void clone(const Node& node);
	//A so called hack to allow destructor to let other functions noe that it is doing cleaning up b4 being deleted. Helps prevent ieterator invalidation problems
	bool nodeDying;
	float mat[16];
	Point4 pos;
	Quat rot;
	
    //Offsets from Parent, calculated during bind time.
	/*Point4 posFromParent;
	Quat rotFromParent;*/
};
}
#endif //__GE_NODE_H__
